<!--html页面,这个页面是给后端的,他那边查询到结果后会自动跳转到这个html页面,通过这个与app内部进行通信-->

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>淘宝宝授权</title>
	</head>
	<body>
		<img style="width: 72px;height: 72px;" src="assets/taobao.png">
		<p style="color: #1B1B1B;">淘宝已授权登录成功</p>
		<button class="btn" type="button" onclick="test()">立即开启购物之旅</button>
	</body>
	<!--这个js一定要引入,是把uni嵌入html的,这样才能调用uni的方法(ps: 官网的链接地址是错误的,用这个)-->
	<script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script>
	<script type="text/javascript">
		function test() {
			var timer = setInterval(function() {
				//判断uni是否已经加载完成,不然在这之前调用是无效的
				if (window.uni) {
					clearInterval(timer);
					uni.postMessage({
							data: {
								action: 'success'
							}
						}),
						uni.navigateBack()
				}
			}, 10)

		}
	</script>
	<style type="text/css">
		.btn {
			width: 50%;
			height: 45px;
			background: linear-gradient(90deg, #f6ad49, #ee7800);
			border-radius: 45px;
			border: 0;
			color: #fff;
			font-size: 16px;
			margin-top: 40%;
		}

		html {
			height: 100%;
		}

		body {
			height: 100%;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
		}
	</style>
</html>
